package com.topc.problem.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.topc.base.model.PageResult;
import com.topc.base.utils.PageUtils;
import com.topc.problem.mapper.ProblemFeedbackInfoMapper;
import com.topc.problem.model.po.ProblemDealInfo;
import com.topc.problem.model.po.ProblemFeedbackInfo;
import com.topc.problem.service.IProblemFeedbackInfoService;
import org.springframework.stereotype.Service;
@Service
public class ProblemFeedbackInfoServiceImpl extends ServiceImpl<ProblemFeedbackInfoMapper, ProblemFeedbackInfo> implements IProblemFeedbackInfoService{


    @Override
    public PageResult<ProblemFeedbackInfo> searchByPage(int pageSize, int pageCurrent, long problemId, String userNumber) {
        LambdaQueryWrapper<ProblemFeedbackInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(!ObjectUtil.isEmpty(problemId), ProblemFeedbackInfo::getProblemId,problemId)
                .eq(!ObjectUtil.isEmpty(userNumber), ProblemFeedbackInfo::getUserNumber,userNumber);
        return PageUtils.pageToResult(this.getBaseMapper().selectPage(PageUtils.toPageBuild(pageSize, pageCurrent),lambdaQueryWrapper));
    }
}
